textview: Properly delete anchored children
authorMatthias Clasen <mclasen@redhat.com>
Thu, 17 Sep 2020 02:58:58 +0000 (22:58 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 17 Sep 2020 03:01:49 +0000 (23:01 -0400)
When we remove anchors with widgets from the text
buffer, we used to call gtk_widget_destroy(), which
indirectly called gtk_container_remove() which cleared
the child properly. When gtk_widget_destroy() was
removed, we replaced the calls with gtk_widget_unparent(),
but that is not enough. Explicitly call
gtk_text_view_remove() instead - we know the parent
is a text view.

gtk/gtktextchild.c

index f569a503bdad4426b89d5c6c26208081dd020dbc..4d5e30e44fceae22a98ca70fcba5e4b67d04bec8 100644 (file)
@@ -236,8 +236,8 @@ child_segment_delete_func (GtkTextLineSegment *seg,
     {
       GtkWidget *child = tmp_list->data;
 
-      gtk_widget_unparent (child);
-      
+      gtk_text_view_remove (GTK_TEXT_VIEW (gtk_widget_get_parent (child)), child);
+
       tmp_list = tmp_list->next;
     }